package createThread.printNumber;

/**
 * @author wang'ji'cheng
 * @date 2025/7/25
 */
public class Number implements Runnable {

    static int number = 1;

    @Override
    public void run() {
        while (true) {
            synchronized (Number.class) {
                if (number > 100) {
                    break;
                } else {
                    if (number % 2 == 1) {
                        System.out.println(Thread.currentThread().getName() + "打印数字" + number);
                    }
                    number++;
                }
            }

        }
    }
}
